/// <reference path="../Util/tool.ts" />

namespace FIREFLYX {
    /** 资源基础类 */
    export abstract class Asset implements IDispose {
        private _isDisposed: boolean = false;

        /** 获取资源ID */
        public UUID: string;
        /** 获取资源名 */
        public name: string;
        /** 是否被销毁 */
        public get isDisposed() { return this._isDisposed; }

        constructor(name: string = "", uuid?: string) {
            this.name = name;
            if (uuid == null) {
                this.UUID = makeUUID();
            } else {
                this.UUID = uuid;
            }
        }

        /** 资源释放销毁 */
        public dispose(): void {
            this._isDisposed = true;
        }
    }
}